package com.jefe.service.model;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;


public class MessageTblClp extends BaseModelImpl<MessageTbl>
    implements MessageTbl {
    private String _shortName;
    private String _heading;
    private String _message;
    private int _id;
    private String _image;

    public MessageTblClp() {
    }

    public int getPrimaryKey() {
        return _id;
    }

    public void setPrimaryKey(int pk) {
        setId(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Integer(_id);
    }

    public String getShortName() {
        return _shortName;
    }

    public void setShortName(String shortName) {
        _shortName = shortName;
    }

    public String getHeading() {
        return _heading;
    }

    public void setHeading(String heading) {
        _heading = heading;
    }

    public String getMessage() {
        return _message;
    }

    public void setMessage(String message) {
        _message = message;
    }

    public int getId() {
        return _id;
    }

    public void setId(int id) {
        _id = id;
    }

    public String getImage() {
        return _image;
    }

    public void setImage(String image) {
        _image = image;
    }

    public MessageTbl toEscapedModel() {
        if (isEscapedModel()) {
            return this;
        } else {
            MessageTbl model = new MessageTblClp();

            model.setEscapedModel(true);

            model.setShortName(HtmlUtil.escape(getShortName()));
            model.setHeading(HtmlUtil.escape(getHeading()));
            model.setMessage(HtmlUtil.escape(getMessage()));
            model.setId(getId());
            model.setImage(HtmlUtil.escape(getImage()));

            model = (MessageTbl) Proxy.newProxyInstance(MessageTbl.class.getClassLoader(),
                    new Class[] { MessageTbl.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public Object clone() {
        MessageTblClp clone = new MessageTblClp();

        clone.setShortName(getShortName());
        clone.setHeading(getHeading());
        clone.setMessage(getMessage());
        clone.setId(getId());
        clone.setImage(getImage());

        return clone;
    }

    public int compareTo(MessageTbl messageTbl) {
        int pk = messageTbl.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        MessageTblClp messageTbl = null;

        try {
            messageTbl = (MessageTblClp) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        int pk = messageTbl.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{shortName=");
        sb.append(getShortName());
        sb.append(", heading=");
        sb.append(getHeading());
        sb.append(", message=");
        sb.append(getMessage());
        sb.append(", id=");
        sb.append(getId());
        sb.append(", image=");
        sb.append(getImage());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("com.jefe.service.model.MessageTbl");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>shortName</column-name><column-value><![CDATA[");
        sb.append(getShortName());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>heading</column-name><column-value><![CDATA[");
        sb.append(getHeading());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>message</column-name><column-value><![CDATA[");
        sb.append(getMessage());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>id</column-name><column-value><![CDATA[");
        sb.append(getId());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>image</column-name><column-value><![CDATA[");
        sb.append(getImage());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
